package com.kuang.springcloud.controller;

import com.kuang.springcloud.pojo.Dept;
import com.kuang.springcloud.service.DeptClientService;
import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;


@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService clientService = null;

    @RequestMapping("/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Integer id) {
        System.out.println("80端口查询id");
        return this.clientService.queryById(id);
    }


    @RequestMapping("/consumer/dept/get/list")
    public List<Dept> list() {
        System.out.println("80端口查询全部");
        return this.clientService.queryAll();
    }


    @RequestMapping("/consumer/dept/add")
    public boolean addDept(@RequestBody Dept dept) {
        System.out.println("80端口添加");
        return this.clientService.addDept(dept);
    }


    @RequestMapping(value = "/consumer/dept/discovery")
    public Object discovery() {

        System.out.println("运行到这了...");
        return this.clientService.discovery();
    }

    @RequestMapping("/cc")
    public String cc() {
        System.out.println("测试你好!");
        return "你好 ";
    }
}
